<?php

 class Controller_Index extends Controller_Base {
 	
    function index($args) {
        $alias    = $this->registry['router_table']['url'][0]  ? $this->registry['router_table']['url'][0] : 'index';
        $id       = $this->menu->getIdByAlias($this->registry['router_table']['alias']);

        $content  = new Model_Content($this->id);
		
        $item     = $content->find();
		
        $template = new Template('index.tmpl');

        $item     = new Model_Item($this->id);

        $template->setArgs(
            array(
                selected    => $alias,
                menu        => $this->menu->getMenu(1),
                sub_menu    => $this->menu->getMenu($this->menu->getIdByAlias($alias)),
                base_alias  => $this->registry['router_table']['url'][0],
                realname    => $this->user->realname,
                content     => $item->get(),
                alias       => $item->get()->alias,
				
                left_menu   => $this->menu->getBranch($this->menu->getIdByAlias('1'),1),
				
                _user       => $this->user,
			)
        );

        return  $template; 
		
 	} 
 }

?>
